<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Spec::Mocks::ArgumentExpectation</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Spec::Mocks::ArgumentExpectation</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/mocks/argument_expectation_rb.html">
                vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000280">args_match?</a>&nbsp;&nbsp;
      <a href="#M000278">constraint_for</a>&nbsp;&nbsp;
      <a href="#M000281">constraints_block_matches?</a>&nbsp;&nbsp;
      <a href="#M000282">constraints_match?</a>&nbsp;&nbsp;
      <a href="#M000279">is_matcher?</a>&nbsp;&nbsp;
      <a href="#M000283">match_any_args?</a>&nbsp;&nbsp;
      <a href="#M000277">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">args</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000277" class="method-detail">
        <a name="M000277"></a>

        <div class="method-heading">
          <a href="#M000277" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000277-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000277-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 7</span>
 7:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
 8:         <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span>
 9:         <span class="ruby-ivar">@constraints_block</span> = <span class="ruby-identifier">block</span>
10:         
11:         <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">AnyArgsConstraint</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
12:           <span class="ruby-ivar">@match_any_args</span> = <span class="ruby-keyword kw">true</span>
13:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">NoArgsConstraint</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
14:           <span class="ruby-ivar">@constraints</span> = []
15:         <span class="ruby-keyword kw">else</span>
16:           <span class="ruby-ivar">@constraints</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">constraint_for</span>(<span class="ruby-identifier">arg</span>)}
17:         <span class="ruby-keyword kw">end</span>
18:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000280" class="method-detail">
        <a name="M000280"></a>

        <div class="method-heading">
          <a href="#M000280" class="method-signature">
          <span class="method-name">args_match?</span><span class="method-args">(given_args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000280-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 30</span>
30:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args_match?</span>(<span class="ruby-identifier">given_args</span>)
31:         <span class="ruby-identifier">match_any_args?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">constraints_block_matches?</span>(<span class="ruby-identifier">given_args</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">constraints_match?</span>(<span class="ruby-identifier">given_args</span>)
32:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000278" class="method-detail">
        <a name="M000278"></a>

        <div class="method-heading">
          <a href="#M000278" class="method-signature">
          <span class="method-name">constraint_for</span><span class="method-args">(arg)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000278-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 20</span>
20:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constraint_for</span>(<span class="ruby-identifier">arg</span>)
21:         <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">MatcherConstraint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arg</span>)   <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_matcher?</span>(<span class="ruby-identifier">arg</span>)
22:         <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">RegexpConstraint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arg</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Regexp</span>)
23:         <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">EqualityProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arg</span>)
24:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000281" class="method-detail">
        <a name="M000281"></a>

        <div class="method-heading">
          <a href="#M000281" class="method-signature">
          <span class="method-name">constraints_block_matches?</span><span class="method-args">(given_args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000281-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000281-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 34</span>
34:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constraints_block_matches?</span>(<span class="ruby-identifier">given_args</span>)
35:         <span class="ruby-ivar">@constraints_block</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@constraints_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">given_args</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
36:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000282" class="method-detail">
        <a name="M000282"></a>

        <div class="method-heading">
          <a href="#M000282" class="method-signature">
          <span class="method-name">constraints_match?</span><span class="method-args">(given_args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000282-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000282-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 38</span>
38:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constraints_match?</span>(<span class="ruby-identifier">given_args</span>)
39:         <span class="ruby-ivar">@constraints</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">given_args</span>
40:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000279" class="method-detail">
        <a name="M000279"></a>

        <div class="method-heading">
          <a href="#M000279" class="method-signature">
          <span class="method-name">is_matcher?</span><span class="method-args">(obj)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000279-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000279-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 26</span>
26:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_matcher?</span>(<span class="ruby-identifier">obj</span>)
27:         <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:matches?</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:description</span>)
28:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000283" class="method-detail">
        <a name="M000283"></a>

        <div class="method-heading">
          <a href="#M000283" class="method-signature">
          <span class="method-name">match_any_args?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000283-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000283-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb, line 42</span>
42:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">match_any_args?</span>
43:         <span class="ruby-ivar">@match_any_args</span>
44:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>